<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:33:"template/manage/setup/system.html";i:1598411654;s:57:"/wwwroot/67.taocen.com/template/manage/common_header.html";i:1595724944;s:54:"/wwwroot/67.taocen.com/template/manage/common_top.html";i:1595724012;s:57:"/wwwroot/67.taocen.com/template/manage/common_footer.html";i:1595918830;}*/ ?>
<!DOCTYPE html>
<html>
<head>
	  <meta charset="utf-8">
  <title>礼物代发管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="/template/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="/template/layuiadmin/style/admin.css" media="all">
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-header">系统设置</div>
      <div class="layui-card-body" style="padding: 15px;">
        <form class="layui-form" action="" lay-filter="component-form-group">

          
          <div class="layui-form-item">
            <label class="layui-form-label">网站名称</label>
            <div class="layui-input-block">
              <input type="text" name="s_webtitle" id="s_webtitle"   placeholder="网站名称" value="<?php echo $config['s_webtitle']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">网站域名</label>
            <div class="layui-input-block">
              <input type="text" name="s_domain" id="s_domain"   placeholder="网站域名，不必填写http或https" value="<?php echo $config['s_domain']; ?>" class="layui-input">
            </div>
          </div>
          
          			<div class="layui-form-item">
                <label class="layui-form-label">收款二维码</label>
                <div class="layui-input-block">
                  <input name="avatar"  class="layui-input" id="avatar" placeholder="收款二维码" value="<?php echo $config['s_qrcode']; ?>">
                </div>
             </div>
		  
          <div class="layui-form-item">
                <div class="layui-input-block">
                 <input type="file" multiple id="filelogo" name="filelogo"  onChange="upfile();" >
                </div>
             </div>
             
             
             <div class="layui-form-item">
            <label class="layui-form-label">二维码提示信息</label>
            <div class="layui-input-block">
              <input type="text" name="s_qrcode_title" id="s_qrcode_title"   placeholder="二维码提示信息" value="<?php echo $config['s_qrcode_title']; ?>" class="layui-input">
            </div>
          </div>

		  
		  <div class="layui-form-item">
            <label class="layui-form-label">版权信息</label>
            <div class="layui-input-block">
              <input type="text" name="s_copyright" id="s_copyright"   placeholder="版权信息" value="<?php echo $config['s_copyright']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">积分比例</label>
            <div class="layui-input-block">
              <input type="text" name="s_credit" id="s_credit"   placeholder="充值积分对换比例例充值1元为1个积分" value="<?php echo $config['s_credit']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">短信功能</label>
            <div class="layui-input-block">
              <input type="radio" name="s_smsswitch" value="1" title="启用" <?php if($config['s_smsswitch']==1): ?>checked=""<?php endif; ?>>
              <input type="radio" name="s_smsswitch" value="2" title="禁用" <?php if($config['s_smsswitch']==2): ?>checked=""<?php endif; ?>>
            </div>
          </div>
		  
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">短信帐号</label>
            <div class="layui-input-block">
              <input type="text" name="s_smsusername" id="s_smsusername"   placeholder="短信平台帐号" value="<?php echo $config['s_smsusername']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">短信密码</label>
            <div class="layui-input-block">
              <input type="text" name="s_smspassword" id="s_smspassword"   placeholder="短信平台密码" value="<?php echo $config['s_smspassword']; ?>" class="layui-input">
            </div>
          </div>
		  
		<div class="layui-form-item">
            <label class="layui-form-label">用户默认群组</label>
            <div class="layui-input-block">
              <select name="ugid" id="ugid">
				<?php if(is_array($group) || $group instanceof \think\Collection || $group instanceof \think\Paginator): $i = 0; $__LIST__ = $group;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo $vo['ug_id']; ?>" <?php if($config['ug_id']==$vo['ug_id']): ?>selected="selected"<?php endif; ?>><?php echo $vo['ug_title']; ?></option>
				<?php endforeach; endif; else: echo "" ;endif; ?>
              </select>
            </div>
          </div>
		  
		  <!--<div class="layui-form-item">
            <label class="layui-form-label">快捷金额</label>
            <div class="layui-input-block">
              <input type="text" name="s_fastmoney" id="s_fastmoney"   placeholder="例10|20|30" value="<?php echo $config['s_fastmoney']; ?>" class="layui-input">
            </div>
          </div>-->
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">直推拥金</label>
            <div class="layui-input-block">
              <input type="text" name="s_commission_one" id="s_commission_one"   placeholder="直推拥金" value="<?php echo $config['s_commission_one']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <!--<div class="layui-form-item">
            <label class="layui-form-label">二级拥金</label>
            <div class="layui-input-block">
              <input type="text" name="s_commission_two" id="s_commission_two"   placeholder="二级拥金" value="<?php echo $config['s_commission_two']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">三级拥金</label>
            <div class="layui-input-block">
              <input type="text" name="s_commission_three" id="s_commission_three"   placeholder="三级拥金" value="<?php echo $config['s_commission_three']; ?>" class="layui-input">
            </div>
          </div>-->
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">最少提现金额</label>
            <div class="layui-input-block">
              <input type="text" name="s_tixian_min" id="s_tixian_min"   placeholder="最少提现金额" value="<?php echo $config['s_tixian_min']; ?>" class="layui-input">
            </div>
          </div>
		
          <!--<div class="layui-form-item">
            <label class="layui-form-label">银行卡提现</label>
            <div class="layui-input-block">
              <input type="radio" name="bank" value="1" title="启用" <?php if($config['s_tongdao_bank']==1): ?>checked=""<?php endif; ?>>
              <input type="radio" name="bank" value="2" title="禁用" <?php if($config['s_tongdao_bank']==2): ?>checked=""<?php endif; ?>>
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">微信提现</label>
            <div class="layui-input-block">
              <input type="radio" name="wx" value="1" title="启用" <?php if($config['s_tongdao_wx']==1): ?>checked=""<?php endif; ?>>
              <input type="radio" name="wx" value="2" title="禁用" <?php if($config['s_tongdao_wx']==2): ?>checked=""<?php endif; ?>>
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">支付宝提现</label>
            <div class="layui-input-block">
              <input type="radio" name="zfb" value="1" title="启用" <?php if($config['s_tongdao_zfb']==1): ?>checked=""<?php endif; ?>>
              <input type="radio" name="zfb" value="2" title="禁用" <?php if($config['s_tongdao_zfb']==2): ?>checked=""<?php endif; ?>>
            </div>
          </div>-->
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">客户QQ</label>
            <div class="layui-input-block">
              <input type="text" name="s_qq1" id="s_qq1"   placeholder="客户QQ" value="<?php echo $config['s_qq1']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">财务QQ</label>
            <div class="layui-input-block">
              <input type="text" name="s_qq2" id="s_qq2"   placeholder="财务QQ" value="<?php echo $config['s_qq2']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">快宝APPID</label>
            <div class="layui-input-block">
              <input type="text" name="s_kuaidihelp_appid" id="s_kuaidihelp_appid"   placeholder="快宝APPID" value="<?php echo $config['s_kuaidihelp_appid']; ?>" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">快宝APPKey</label>
            <div class="layui-input-block">
              <input type="text" name="s_kuaidihelp_appkey" id="s_kuaidihelp_appkey"   placeholder="快宝APPKey" value="<?php echo $config['s_kuaidihelp_appkey']; ?>" class="layui-input">
            </div>
          </div>
          
          
          <!-- 银行操作 2020-08-17 -->
		<div class="layui-form-item">
            <label class="layui-form-label">银行充值</label>
            <div class="layui-input-block">
              <input type="radio" name="s_bank_open" value="1" title="启用" <?php if($config['s_bank_open']==1): ?>checked=""<?php endif; ?>>
              <input type="radio" name="s_bank_open" value="2" title="禁用" <?php if($config['s_bank_open']==2): ?>checked=""<?php endif; ?>>
            </div>
          </div>
          
          <div class="layui-form-item">
            <label class="layui-form-label">银行名称</label>
            <div class="layui-input-block">
              <input type="text" name="s_bank_title" id="s_bank_title"   placeholder="银行名称" value="<?php echo $config['s_bank_title']; ?>" class="layui-input">
            </div>
          </div>
          
          <div class="layui-form-item">
            <label class="layui-form-label">开户行信息</label>
            <div class="layui-input-block">
              <input type="text" name="s_bank_content" id="s_bank_content"   placeholder="开户行信息" value="<?php echo $config['s_bank_content']; ?>" class="layui-input">
            </div>
          </div>
          
          <div class="layui-form-item">
            <label class="layui-form-label">持卡人</label>
            <div class="layui-input-block">
              <input type="text" name="s_bank_username" id="s_bank_username"   placeholder="银行卡持卡人" value="<?php echo $config['s_bank_username']; ?>" class="layui-input">
            </div>
          </div>
          
          <div class="layui-form-item">
            <label class="layui-form-label">银行卡号</label>
            <div class="layui-input-block">
              <input type="text" name="s_bank_card" id="s_bank_card"   placeholder="银行卡号" value="<?php echo $config['s_bank_card']; ?>" class="layui-input">
            </div>
          </div>
         
          
          <!-- 银行操作 2020-08-17 -->
		  
          <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
              <div class="layui-footer" style="left: 0;">
                <div class="layui-btn sub">立即提交</div>
                <button type="reset" class="layui-btn layui-btn-primary ">重置</button>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
<script src="/template/layuiadmin/layui/layui.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="/template/showjs.js"></script>
<script>
  layui.config({
    base: '/template/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index','form', 'laydate','set']);
</script> 
<script>
function upfile(){
	//alert("上传中");
	var timestamp  = Date.parse(new Date());
	var upload_url = "<?php echo url('upload/upload'); ?>";
	var files      = document.getElementById("files");
	var formData = new FormData();
	formData.append("filename", document.getElementById("filelogo").files[0]);
	//var f = 1
	var file = document.getElementById("filelogo").files[0];
	if (file) {
		var fileSize = 0;
		if (file.size > 1024 * 1024){
			fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + 'MB';
		}else{
			fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + 'KB';
		}      

		//alert("上传中:"+fileSize);
		var xhr = new XMLHttpRequest();
	
		/* 事件监听 */
		xhr.upload.addEventListener("progress", uploadProgress, false);
		xhr.addEventListener("load", uploadComplete, false);
		xhr.addEventListener("error", uploadFailed, false);
		xhr.addEventListener("abort", uploadCanceled, false);
		/* 下面的url一定要改成你要发送文件的服务器url */
		xhr.open("POST",upload_url);
		xhr.send(formData);
		
		function uploadProgress(evt) {
			if (evt.lengthComputable) {
				//if(f==1){
		 		//	f=2;
					//uploadload();
		 		//}
				var percentComplete = Math.round(evt.loaded * 100 / evt.total);
				//document.getElementById('upload_text').innerHTML = percentComplete.toString() + '%';
			}else {
				//document.getElementById('upload_text').innerHTML = '无法计算';
			}
		}
	
		/*function uploadload(evt){
			files.innerHTML = files.innerHTML + "<li class=\"weui-uploader__file weui-uploader__file_status\" id=\"file_"+timestamp+"\"><div class=\"weui-uploader__file-content\" id=\"upload_text\">1</div></li>";
		}*/
	
		function uploadComplete(evt) {
			/* 当服务器响应后，这个事件就会被触发 */
			//alert(evt.target.responseText);
			//ErrorAlert(evt.target.responseText);
			
			var obj = JSON.parse(evt.target.responseText);
			if(obj.success=="ok"){
				$("#avatar").val(obj.fileurl);
				//$("#aa_img"+id).attr("src", obj.fileurl);
			}else{
				show_error(obj.msg);
			}
		}
	
		function uploadFailed(evt) {
			show_error("上传文件发生了错误尝试");
		}
	
		function uploadCanceled(evt) {
			show_error("上传被用户取消或者浏览器断开连接");
		}  
	}	

} 









$(".sub").click(function(){
	//if(!$(".btn").hasClass("sub")){return false;}
	var ugid        = $("#ugid").val();
	var s_webtitle  = $("#s_webtitle").val();
	var s_domain  = $("#s_domain").val();
	var s_copyright  = $("#s_copyright").val();
	var s_credit  = $("#s_credit").val();
	var s_smsusername  = $("#s_smsusername").val();
	var s_smspassword  = $("#s_smspassword").val();
	var s_fastmoney  = $("#s_fastmoney").val();
	var s_commission_one  = $("#s_commission_one").val();
	var s_commission_two  = $("#s_commission_two").val();
	var s_commission_three  = $("#s_commission_three").val();
	var s_tixian_min  = $("#s_tixian_min").val();
	var s_smsswitch = $("input[name='s_smsswitch']:checked").val();
	var bank = $("input[name='bank']:checked").val();
	var wx = $("input[name='wx']:checked").val();
	var zfb = $("input[name='zfb']:checked").val();

	var s_qq1  = $("#s_qq1").val();
	var s_qq2  = $("#s_qq2").val();
	
	var s_kuaidihelp_appid  = $("#s_kuaidihelp_appid").val();
	var s_kuaidihelp_appkey  = $("#s_kuaidihelp_appkey").val();
	 
	var avatar  = $("#avatar").val();
	var s_qrcode_title  = $("#s_qrcode_title").val();
	
	
	var s_bank_open = $("input[name='s_bank_open']:checked").val();
	var s_bank_title  = $("#s_bank_title").val();
	var s_bank_content  = $("#s_bank_content").val();
	var s_bank_username  = $("#s_bank_username").val();
	var s_bank_card  = $("#s_bank_card").val();
	
	           
	

	if(s_webtitle == ""){
		show_error("网站名称不能为空！");
		return false
	}
	
	if(s_credit == ""){
		show_error("积分比例不能为空！");
		return false
	}
	
	if(s_fastmoney == ""){
		show_error("快捷金额不能为空！");
		return false
	}
	
	
	if(s_commission_one == ""){
		show_error("直推拥金不能为空！");
		return false
	}
	
	if(s_commission_two == ""){
		show_error("二级拥金不能为空！");
		return false
	}
	
	if(s_commission_three == ""){
		show_error("三级拥金不能为空！");
		return false
	}
	
	if(s_tixian_min == ""){
		show_error("最少提现金额不能为空！");
		return false
	}
	

	
	$.ajax({
		type:"POST",
		url:"<?php echo url('setup/system'); ?>",
		dataType:"json",
		data:{
			 s_qrcode_title:s_qrcode_title,
			 avatar:avatar,
			 s_qq1:s_qq1,
			 s_qq2:s_qq2,
			 ugid:ugid,
			 s_webtitle:s_webtitle,
			 s_domain:s_domain,
			 s_copyright:s_copyright,
			 s_credit:s_credit,
			 s_smsusername:s_smsusername,
			 s_smspassword:s_smspassword,
			 s_fastmoney:s_fastmoney,
			 s_commission_one:s_commission_one,
			 s_commission_two:s_commission_two,
			 s_commission_three:s_commission_three,
			 s_tixian_min:s_tixian_min,
			 s_smsswitch:s_smsswitch,
			 bank:bank,
			 wx:wx,
			 zfb:zfb,
			 s_kuaidihelp_appid:s_kuaidihelp_appid,
			 s_kuaidihelp_appkey:s_kuaidihelp_appkey,
			 
			 
			 s_bank_open:s_bank_open,
			 s_bank_title:s_bank_title,
			 s_bank_content:s_bank_content,
			 s_bank_username:s_bank_username,
			 s_bank_card:s_bank_card,
		},

		success:function(res){
			if(res.status == "success"){
				show_toast_callurl(res.data,"<?php echo url('setup/system'); ?>","success");
			}else{
				show_error(res.data);
			}
		},
		error:function(jqXHR){
			console.log("Error: "+jqXHR.status);
		},
	});
	
});
</script>
</body>
</html>
